// index.js
Page({
  data: {
    picList: ['/images/pic1.jpg', '/images/pic2.jpg', '/images/pic3.jpg'],
    // picList:[],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1300,
    bg: '#C79C77',
   
  },

   
  goto: function (e) {
    wx.navigateTo({
      url: '../home/home',
    })
  },
  gotoWordList: function (e) {
    wx.navigateTo({
      url: '../wordList/wordList',
    })
  },
  gotoWordAdd: function (e) {
    wx.navigateTo({
      url: '../wordAdd/wordAdd',
    })
  },
  onLoad() {
    console.log("访问云数据库中的表")
    const db = wx.cloud.database()
    console.log(db)
    
    //  查询所有轮播图数据记录
    db.collection('pics').get().then(res => {
        // res.data 包含该记录的数据
        console.log(res)
        console.log(res.data)
        let newpicList = []
        res.data.forEach((item,index)=>{
          console.log(item)
          console.log(index)
          newpicList.push(item)
        })
        console.log(newpicList)
        this.setData({
          picList:newpicList
        })
    })

  }

})